<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Article extends MY_Controller {

	function __construct()
	{
		parent::__construct();
		
		
	}

	function index()
	{
		if ($this->uri->segment(2) === FALSE)
		{
			$temp = $this->articles->get_random_entry();
			$data['article'] = $temp[0];
		}
		else
		{
			$data['article_id'] = $this->uri->segment(2);
            $data['article'] = OxArticle::from_id($data['article_id']);
		}
	
        $data['flags'] = $this->flags->all_flag_types();
        
        $a = $data['article'];
		 $b = array ();
         if($a->story)
         {
             $b[] = $this->BoxStory($a->story);
         }
         
         
         $b[] = $this->BoxFeatured();
		 $b[] = $this->BoxRecentRelated($a);
		 $b[] = $this->BoxSuggestedReading($a);
		
        $data2['boxes'] = $b;
                 
		$this->ShowHeader();
		$this->load->view('article_page', $data);
		$this->load->view('box_frame', $data2);
		$this->ShowFooter();
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */